import axios from "@/utlis/requests";
import path from "@/api/path";

const api = {
    Login(data){
        return axios.post(path.BaseUrl + path.LoginUrl, data)
    },
    pullUserInfoData(user_id){
        return axios.post(path.BaseUrl + path.UserInfoDataUrl, {type: "2001", user_id})
    },
    pushUserInfoData(data){
        return axios.post(path.BaseUrl + path.UserInfoDataUrl, encodeURIComponent(JSON.stringify(data)))
    },
    pullBasicTeachData(user_id) {
        return axios.post(path.BaseUrl + path.BasicTeachDataUrl, {type: "3001", user_id})
    },
    pushBasicTeachDat(data) {
        return axios.post(path.BaseUrl + path.BasicTeachDataUrl, encodeURIComponent(JSON.stringify(data)))
    },
    pullMajorCourseData(user_id) {
        return axios.post(path.BaseUrl + path.MajorCourseDataUrl, {type: "4001", user_id})
    },
    pushMajorCourseData(data) {
        return axios.post(path.BaseUrl + path.MajorCourseDataUrl, encodeURIComponent(JSON.stringify(data)))
    },
    pullTeacherResearchReformData(user_id) {
        return axios.post(path.BaseUrl + path.TeacherResearchReformDataUrl, {type: "5001", user_id})
    },
    pushTeacherResearchReformData(data) {
        return axios.post(path.BaseUrl + path.TeacherResearchReformDataUrl, encodeURIComponent(JSON.stringify(data)))
    },
    pullTeacherCorpPracticalData(user_id) {
        return axios.post(path.BaseUrl + path.TeacherCorpPracticalDataUrl, {type: "6001", user_id})
    },
    pushTeacherCorpPracticalData(data) {
        return axios.post(path.BaseUrl + path.TeacherCorpPracticalDataUrl, encodeURIComponent(JSON.stringify(data)))
    },
    pullArchiveExportData(user_id) {
        return axios.post(path.BaseUrl + path.ArchiveExportDataUrl, {type: "7001", user_id})
    },
    pushArchiveExportData(user_id) {
        return axios.post(
            path.BaseUrl + path.ArchiveExportDataUrl, {type: "7002", user_id},
            {responseType: 'blob'}
        )
    },
    /*
    * 2023-02-16 18:06 增加修改密码功能
    * */
    pushChangePasswordData(data) {
        return axios.post(`${path.BaseUrl}/UserModuleServlet`, {type: '1002', ...data})
    }
}

export default api